package org.tutorial.client;

import javax.xml.ws.soap.SOAPBinding;

import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import org.tutorial.oxm.SayHelloRequest;
import org.tutorial.oxm.SayHelloResponse;

/**
 * Handles SayHello requests.
 */
@Endpoint(value = SOAPBinding.SOAP11HTTP_BINDING)
public class HelloEndpoint {

	@PayloadRoot(localPart = "sayHelloRequest", namespace = "http://company.com/ws/sample/castor/schema")
	@ResponsePayload
	public SayHelloResponse sayHello(@RequestPayload
	SayHelloRequest request) {
		SayHelloResponse response = new SayHelloResponse();
		response.setResponse(String.format("SOAP11 server says: Hello %s", request.getText()));
		return response;
	}
}
